//import Layout from "@/layout";
//import LayoutParent from "@/layout/routerView/parent.vue";
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称
 *      isLink：        是否超链接菜单，开启外链条件，`1、isLink:true 2、链接地址不为空`
 *      hide/isHide：        是否隐藏此路由
 *      cache/isKeepAlive：   是否缓存组件状态
 *      affix/isAffix：       是否固定在 tagsView 栏上
 *      isIframe：      是否内嵌窗口，，开启条件，`1、isIframe:true 2、链接地址不为空`
 *      auth：          当前路由权限标识（多个请用逗号隔开），最后转成数组格式，用于与当前用户权限进行对比，控制路由显示、隐藏
 *      icon：          菜单、tagsView 图标
 * }
 */

/**
 * 定义静态路由
 * @description 前端控制直接改 dynamicRoutes 中的路由，后端控制不需要修改，请求接口路由数据时，会覆盖 dynamicRoutes 第一个顶级 children 的内容（全屏，不包含 layout 中的路由出口）
 * @returns 返回路由菜单数据
 */
export const constantRoutes = [
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/common/login/index.vue"),
    meta: {
      title: "登录",
    },
  },
  {
    path: "/404",
    name: "notFound",
    component: () => import("@/views/common/error/404.vue"),
    meta: {
      title: "资源未找到",
    },
  },
  {
    path: "/401",
    name: "noPower",
    component: () => import("@/views/common/error/401.vue"),
    meta: {
      title: "没有权限",
    },
  },
  {
    path: "/ifram1",
    name: "ifram1",
    component: () => import("@/views/iframe-pages/ifram1.vue"),
    meta: {
      title: "内嵌页面1_1",
    },
  },
  {
    path: "/link1",
    name: "link1",
    component: () => import("@/views/link-pages/link1.vue"),
    meta: {
      title: "没有权限",
    },
  },
];

/**
 * 定义动态路由
 * @description isRequestRoutes = false（前端控制路由），isRequestRoutes = true 开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据
 * @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm`
 * @returns 返回路由菜单数据
 */
export const dynamicRoutes = [
  {
    path: "/",
    name: "/",
    component: () => import("@/layout/index.vue"),
    redirect: "/home",
    meta: {
      isKeepAlive: true,
    },
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("@/views/home/index.vue"),
        meta: {
          title: "message.router.home",
          isLink: "",
          isHide: false,
          isKeepAlive: true,
          isAffix: true,
          isIframe: false,
          auth: ["admin", "test"],
          icon: "iconfont icon-shouye",
        },
      },
      {
        path: "/system",
        name: "system",
        component: () => import("@/layout/routerView/parent.vue"),
        redirect: "/system/menu",
        meta: {
          title: "message.router.system",
          isLink: "",
          isHide: false,
          isKeepAlive: true,
          isAffix: false,
          isIframe: false,
          auth: ["admin"],
          icon: "iconfont icon-xitongshezhi",
        },
        children: [
          {
            path: "/system/menu",
            name: "systemMenu",
            component: () => import("@/views/system/menu/index.vue"),
            meta: {
              title: "message.router.systemMenu",
              isLink: "",
              isHide: false,
              isKeepAlive: true,
              isAffix: false,
              isIframe: false,
              auth: ["admin"],
              icon: "iconfont icon-caidan",
            },
          },
          {
            path: "/system/user",
            name: "systemUser",
            component: () => import("@/views/system/user/index.vue"),
            meta: {
              title: "message.router.systemUser",
              isLink: "",
              isHide: false,
              isKeepAlive: true,
              isAffix: false,
              isIframe: false,
              auth: ["admin"],
              icon: "iconfont icon-icon-",
            },
          },
        ],
      },
    ],
  },
];
